package segger.vasttrafik.parsing;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;



public class LocationParseHandler extends XMLParseHandler {
    private static final String STOP_LOCATION = "StopLocation";
    private static final String COORD_LOCATION = "CoordLocation";
    
    private StopLocation location = null;
    
    @Override
    public void startElement(String uri, String localName, String qName,
            Attributes attr) throws SAXException {
        if(qName.equalsIgnoreCase(STOP_LOCATION)) {
            if(location == null) {
                location = new StopLocation(attr);
            }
        }
    }

    public String getStopID() {
        return location.getStopID();
    }
    
    class StopLocation {
        private String name, stopID;
        
        public StopLocation(Attributes attributes) {
            this.name = attributes.getValue("name");
            this.stopID = attributes.getValue("id");
        }
        
        public String getName() {
            return name;
        }
        
        public String getStopID() {
            return stopID;
        }
    }
}
